/*
 * TIMER.h
 *
 * Created: 22/04/2012 11:28:52 AM
 *  Author: Richard
 */ 


#ifndef TIMER_H_
#define TIMER_H_

#include <avr/io.h>
#include "cdef.h"


typedef enum
{
	TIMER_nenFirst = 0,

	/* Start integration */
	TIMER_nenTestTimer = TIMER_nenFirst,
	/* End integrations */

	TIMER_nenNumberOfChannels
} TIMER_tenChannels;	

typedef enum
{
	TIMER_nenFreeRunning = 0,
	TIMER_nenOneShot,
	TIMER_nenStopped
} TIMER_tenTimerMode;	

void TIMER_vReset( void );

void TIMER_vInterruptHook( void );

bool TIMER_boStartTimer( const TIMER_tenChannels enChannel,
						 const uint16 u16TimeoutMs,
						 const TIMER_tenTimerMode enMode,
						 void (*tFuncCallback)(void) );
						 
void TIMER_vStopTimer( const TIMER_tenChannels enChannel );
						 
bool TIMER_boIsTimerActive( const TIMER_tenChannels enChannel );

void TIMER_vBackgroundTask( void );

#endif /* TIMER_H_ */
